package com.boc.ewr.bcimp.service.impl;

import com.boc.ewr.bcimp.entity.OutsrcBillInfoCnfm;
import com.boc.ewr.bcimp.entity.QccOprtRisk;
import com.boc.ewr.bcimp.mapper.OutsrcBillInfoCnfmMapper;
import com.boc.ewr.bcimp.service.IOutsrcBillInfoCnfmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @Description: 账单信息确认表
 * @Author: jeecg-boot
 * @Date:   2023-06-18
 * @Version: V1.0
 */
@Service
public class OutsrcBillInfoCnfmServiceImpl extends ServiceImpl<OutsrcBillInfoCnfmMapper, OutsrcBillInfoCnfm> implements IOutsrcBillInfoCnfmService {

    @Autowired
    OutsrcBillInfoCnfmMapper outsrcBillInfoCnfmMapper;
    //批量导入
    @Transactional
    public boolean initSaveBatch(Collection<OutsrcBillInfoCnfm> entityList, Boolean flag){
        if(entityList.isEmpty() || entityList.size() == 0) {
            return false;
        }
        // 清除之前数据
        if (flag) {
            outsrcBillInfoCnfmMapper.delete(null);
        }

        // 再统一插入数据
        return saveBatch(entityList, DEFAULT_BATCH_SIZE);
    }
}
